﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Index2.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    死者统计查询
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var id = 'DeadNO';
        var ctrlName = 'DeaderQueryService';
        function Crud2(id, ctrlName) {
            //根据时间段查询消费金额，查询的结果不分页
            this.Search = function () {
                var form = $('#fm');
                if (!$(form).form('validate')) {
                    return;
                }
                url = '../' + ctrlName + '/SearchByTimeAndCity';
                var data = $(form).serialize();
                $.post(url, data, function (result) {
                    if (result.success) {
                        $('#dg').datagrid('loadData', result);        // reload the user data
                    } else {
                        $.messager.show({
                            title: '错误',
                            msg: result.msg
                        });
                    }
                });
            };

            //打印死者列表
            this.Print = function () {
                var form = $('#fm');
                if (!$(form).form('validate')) {
                    return;
                }
                var data = $(form).serialize();
                var url = '../' + ctrlName + '/PrintDeadList?' + data;
                ShowDialog(url, 'PrintDeadFeeBill', '800px', '600px');
            };
        }
        var crud = new Crud2(id, ctrlName);
        $(function () {
            $('#dg').datagrid({
                title: '死者消费查询',
                iconCls: 'icon-save',
                url: '../' + ctrlName + '/DeadList',
                sortName: id,
                sortOrder: 'asc',
                remoteSort: false,
                idField: id,
                frozenColumns: [[
	                { field: 'ck', checkbox: true },
	                { title: '死者编号', field: id, width: 80, sortable: true },
                    { field: 'DeadName', title: '死者姓名', width: 80 }
				]],
                columns: [[                        
                        { field: 'DeadSex', title: '死者性别', width: 80 },
                        { field: 'DeadAge', title: '死者年龄', width: 80 },
                        { field: 'DeadNation', title: '民族', width: 80 },
                        { field: 'DeadCity', title: '县(市)', width: 80 },
                        { field: 'DeadTime', title: '死亡时间', width: 150,
                            formatter: function (value) {
                                return JsonToDateString(value, 'yyyy-MM-dd hh:mm:ss');
                            }
                        },                        
                        { field: 'DeadReason', title: '死亡原因', width: 100 },   
                        { field: 'BurialMode', title: '下葬方式', width: 100 },                        
                        { field: 'TotalFee', title: '应付费(元)', width: 80 },
                        { field: 'PaidFee', title: '已付费(元)', width: 80 },
                        { field: 'FamilyName', title: '亲属姓名', width: 80 },
                        { field: 'FamilyPhone', title: '亲属电话', width: 80 }
                    ]],
                pagination: false,
                fitColumns: true,
                showFooter: true,
                toolbar: '#tb'
            });
        });            
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dlg" class="easyui-dialog" closed="true" buttons="#dlg-buttons" style="width: 600px;
        height: 400px; padding: 10px 20px">
        <div class="ftitle">死者统计查询</div>
    </div>
   <div id="tb" style="padding:5px;height:auto">   
        <div>
            <form id="fm">
            时间：从 <input name="StartTime"   class="easyui-datebox" style="width:120px" required="true" />
            到<input name="EndTime"   class="easyui-datebox" style="width:120px" required="true" />
            县(市): <input name="DeadCity" class="easyui-validatebox"   style="width:80px"/>           
            <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="crud.Search()">
                查询</a>
            <!--a href="#" class="easyui-linkbutton" iconcls="icon-print" onclick="crud.Print()">
                打印</a-->
            </form>
        </div>
    </div>    
</asp:Content>
